self.onmessage = function (e) {
    /** @type { HTMLCanvasElement } */
    const canvasDom = e.data;
    const context = canvasDom.myCanvas.getContext('2d');
    context.moveTo(10, 30);
    context.lineTo(100, 66);
    context.stroke();
    drawFont(context, 'dyx')

    self.postMessage('完成！')
}
// 画图函数
const drawFont = (context, txt) => {
    context.save()
    context.font = '15px 微软雅黑';
    context.fillStyle = '#30f'
    const lineHeight = 25

    const lineNum = 19
    const wordsPerLine = 10000
    for (let i = 0; i < lineNum; i++) {
        let lineTxt = ''
        for (let j = 0; j < wordsPerLine; j++) {
            lineTxt += `${txt}-${i + 1}-${j + 1} `
        }
        context.fillText(lineTxt, 40, lineHeight * (i + 1))
    }
    context.restore()
}